let Mock = require('mockjs');
let express = require('express');
let router = express.Router();

const random = Mock.Random;
router.use('/line-chart',function(req,res){
  console.log(req.body);
  let data = Mock.mock({
    status:0,
    data:{
      staticsTime:[1587830400000, 1588435200000, 1589040000000, 1589644800000, 1590249600000],
      avgValue:[10,0,0,0,10],
      maxValue:[0,0,8,0,0],
      minValue:[0,5,0,5,0]
    }
  })
  setTimeout(() => {
    return res.json(data);
  },3000)
})

router.use('/result',function(req,res){
  let data = Mock.mock({
    status:0,
    data:['我是1','我是2','我是3','我是4']
  })
  setTimeout(() => {
    return res.json(data);
  },3000)
})

router.use('/search',function(req,res){
  let data = Mock.mock({
    code: 200,
    'data|1000-3000': [{
      imgLink: random.image(),
      title: random.title(),
      'asin|+1': 100,
      titleLink: 'https://www.baidu.com',
      'skuInfo|1-3': [{
        sku: 'apple in the kitchen',
        'skuStatus|1': ['Inactive', 'Incompleted', 'deleted', ''],
      }],
    }],
  })
  setTimeout(() => {
    return res.json(data);
  },3000)
})
module.exports =router;